package com.dispacher.context;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public abstract class RequestContext {
	
	public static Object getParameter(String key) {
		return ContextHolder.findInstance().getRequest().getParameter(key);
	}

	public static HttpServletRequest getCommonRequest() {
		return ContextHolder.findInstance().getRequest();
	}

	public static void setReqeustAttr(String key, Object value) {
		ContextHolder.setRequestAttribute(key, value);
	}

	public static String getRequestUrl() {
		return ContextHolder.findInstance().getRequestUrl();
	}

	public static Object buildObjectFromContext(Class cla) {
		return ContextHolder.initFromTheRequest(cla);
	}

	public static HttpSession getCurSession() {
		return ContextHolder.getCurSession();
	}

	public static void setSessionAttribute(String key, String value) {
		ContextHolder.getCurSession().setAttribute(key, value);
	}

}
